﻿/****************************************************************************
Copyright (c) 2014-2015 凌惊雪 微信:Lingjingxue 邮箱:lingjingxue@sina.com QQ:271487457

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/

using System;
using System.Collections.Generic;
using UtilPublic.Redis;

namespace UtilPublic.Redis
{
    /// <summary>
    /// 服务器Modis连接信息
    /// </summary>
    public static partial class ServerRedis
    {
        /// <summary>
        /// 加入
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="score"></param>
        public static void AStSetAdd<T>(string key, T value, long score)
        {
            RedisGame.StSetAdd(key, value, score);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public static void AStSetRemove<T>(string key, T value)
        {
            RedisGame.StSetRemove(key, value);
        }
        /// <summary>
        /// 获取分数
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public static long AStSetScore<T>(string key, T value)
        {
            return RedisGame.StSetScore(key, value);
        }
        /// <summary>
        /// 获取长度
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static long AStSetGetLength(string key)
        {
            return RedisGame.StSetGetLength(key);
        }
        /// <summary>
        /// 获取列表 根据排名
        /// </summary>
        /// <param name="key"></param>
        /// <param name="startRank"></param>
        /// <param name="stopRank"></param>
        /// <param name="Descending"></param>
        /// <returns></returns>
        public static List<BaseTopDataRedis> AStSetRangeByRank(string key, int startRank, int stopRank, bool Descending = false)
        {
            return RedisGame.StSetRangeByRank(key, startRank, stopRank, Descending);
        }
        /// <summary>
        /// 获取列表 根据页码
        /// </summary>
        /// <param name="key"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageCount"></param>
        /// <param name="Descending"></param>
        /// <returns></returns>
        public static List<string> AStSetRangeByPage(string key, int pageIndex = 0, int pageCount = 100, bool Descending = false)
        {
            return RedisGame.StSetRangeByPage(key, pageIndex, pageCount, Descending);
        }
        /// <summary>
        /// 清除
        /// </summary>
        /// <param name="key"></param>
        public static void AStSetRemoveAll(string key)
        {
            RedisGame.StSetRemoveAll(key);
        }
        /// <summary>
        /// 获取排行榜
        /// </summary>
        /// <param name="key"></param>
        /// <param name="Descending"></param>
        /// <returns></returns>
        public static List<BaseTopDataRedis> AStSetRangeByRankAll(string key, bool Descending = false)
        {
            return RedisGame.StSetRangeByRankAll(key, Descending);
        }
    }
}